package com.breezelin.card.app;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;

import com.breezelin.card.app.adapterview.CardAdapterViewActivity;
import com.breezelin.card.app.recyclerview.CardRecyclerViewActivity;

/**
 * 主页，选择要看的模式
 */
public class MainActivity extends AppCompatActivity implements View.OnClickListener {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        findViewById(R.id.btn_adapter_view_ordered).setOnClickListener(this);
        findViewById(R.id.btn_adapter_view_disordered).setOnClickListener(this);
        findViewById(R.id.btn_adapter_view_lined).setOnClickListener(this);
        findViewById(R.id.btn_recycler_view).setOnClickListener(this);
        findViewById(R.id.btn_frame_layout).setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            // AdapterView有序
            case R.id.btn_adapter_view_ordered: {
                Intent intent = new Intent(this, CardAdapterViewActivity.class);
                intent.putExtra(Constants.Key.ORIENTATION, Constants.Orientation.Ordered);
                startActivity(intent);
                break;
            }
            // AdapterView无序
            case R.id.btn_adapter_view_disordered: {
                Intent intent = new Intent(this, CardAdapterViewActivity.class);
                intent.putExtra(Constants.Key.ORIENTATION, Constants.Orientation.Disordered);
                startActivity(intent);
                break;
            }
            // AdapterView排队
            case R.id.btn_adapter_view_lined: {
                Intent intent = new Intent(this, CardAdapterViewActivity.class);
                intent.putExtra(Constants.Key.ORIENTATION, Constants.Orientation.Lined);
                startActivity(intent);
                break;
            }
            // RecyclerView
            case R.id.btn_recycler_view: {
                startActivity(new Intent(this, CardRecyclerViewActivity.class));
                break;
            }
            // FrameLayout
            case R.id.btn_frame_layout: {
                // TODO: 17-12-8
                break;
            }
        }
    }
}
